import { FormControlProps, SelectChangeEvent } from '@mui/material'

type Props = {
  id: string
  label: string
  options: { value: any; label: string; disabled?: boolean }[]
  value: any
  onChange: (e: SelectChangeEvent) => void
} & Omit<FormControlProps, 'onChange'>

const AdvisorStageSelect = ({ id, label, options, value, onChange, ...rest }: Props) => {
  return (
    <FormControl fullWidth {...rest}>
      <InputLabel id={`${id}-label`}>{label}</InputLabel>
      <Select label={label} labelId={`${id}-label`} onChange={onChange} value={value}>
        {options.map((item, index) => (
          <MenuItem key={index} value={item.value} disabled={item.disabled}>
            <Typography variant="button">{item.label}</Typography>
          </MenuItem>
        ))}
      </Select>
    </FormControl>
  )
}

export default AdvisorStageSelect
